/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.wins.vertx.entity;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;

/**
 * Converter for {@link io.wins.vertx.entity.Root}.
 *
 * NOTE: This class has been automatically generated from the {@link io.wins.vertx.entity.Root} original class using Vert.x codegen.
 */
public class RootConverter {

  public static void fromJson(JsonObject json, Root obj) {
    if (json.getValue("createdOn") instanceof String) {
      obj.setCreatedOn((String)json.getValue("createdOn"));
    }
    if (json.getValue("description") instanceof String) {
      obj.setDescription((String)json.getValue("description"));
    }
    if (json.getValue("name") instanceof String) {
      obj.setName((String)json.getValue("name"));
    }
    if (json.getValue("parentId") instanceof String) {
      obj.setParentId((String)json.getValue("parentId"));
    }
    if (json.getValue("seq") instanceof Number) {
      obj.setSeq(((Number)json.getValue("seq")).intValue());
    }
    if (json.getValue("type") instanceof String) {
      obj.setType((String)json.getValue("type"));
    }
    if (json.getValue("updatedOn") instanceof String) {
      obj.setUpdatedOn((String)json.getValue("updatedOn"));
    }
    if (json.getValue("url") instanceof String) {
      obj.setUrl((String)json.getValue("url"));
    }
  }

  public static void toJson(Root obj, JsonObject json) {
    if (obj.getCreatedOn() != null) {
      json.put("createdOn", obj.getCreatedOn());
    }
    if (obj.getDescription() != null) {
      json.put("description", obj.getDescription());
    }
    if (obj.getId() != null) {
      json.put("id", obj.getId());
    }
    if (obj.getName() != null) {
      json.put("name", obj.getName());
    }
    if (obj.getParentId() != null) {
      json.put("parentId", obj.getParentId());
    }
    json.put("seq", obj.getSeq());
    if (obj.getType() != null) {
      json.put("type", obj.getType());
    }
    if (obj.getUpdatedOn() != null) {
      json.put("updatedOn", obj.getUpdatedOn());
    }
    if (obj.getUrl() != null) {
      json.put("url", obj.getUrl());
    }
  }
}